require 'rho/rhocontroller'
require 'helpers/browser_helper'

class HCDEController < Rho::RhoController
  include BrowserHelper

  #GET /HCDE
  def index
    @hcdes = HCDE.find(:all)
    render :back => '/app'
  end

  # GET /HCDE/{1}
  def show
    @hcde = HCDE.find(@params['id'])
    if @hcde
      render :action => :show, :back => url_for(:action => :index)
    else
      redirect :action => :index
    end
  end

  # GET /HCDE/new
  def new
    @hcde = HCDE.new
    render :action => :new, :back => url_for(:action => :index)
  end

  # GET /HCDE/{1}/edit
  def edit
    @hcde = HCDE.find(@params['id'])
    if @hcde
      render :action => :edit, :back => url_for(:action => :index)
    else
      redirect :action => :index
    end
  end

  # POST /HCDE/create
  def create
    @hcde = HCDE.create(@params['hcde'])
    redirect :action => :index
  end

  # POST /HCDE/{1}/update
  def update
    @hcde = HCDE.find(@params['id'])
    @hcde.update_attributes(@params['hcde']) if @hcde
    redirect :action => :index
  end

  # POST /HCDE/{1}/delete
  def delete
    @hcde = HCDE.find(@params['id'])
    @hcde.destroy if @hcde
    redirect :action => :index  end
end
